package o;

import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;
import com.huawei.appgallery.downloadengine.api.SessionDownloadTask;
import com.huawei.hms.support.hianalytics.HiAnalyticsConstant;
import com.huawei.secure.android.common.intent.SafeBroadcastReceiver;

class bne extends SafeBroadcastReceiver {
    bne() {
    }

    static void ॱ(SessionDownloadTask sessionDownloadTask) {
        Context ॱ = bnl.ˏ().ॱ();
        Intent intent = new Intent("ACTION_ENQUEUE_TASK");
        intent.putExtra(HiAnalyticsConstant.BI_KEY_PACKAGE, sessionDownloadTask.ˊˊ());
        intent.putExtra("sessionId", sessionDownloadTask.ʾ());
        intent.setClass(ॱ, bne.class);
        ll.ˏ(ॱ).ˋ(intent);
    }

    static void ˎ(SessionDownloadTask sessionDownloadTask) {
        Context ॱ = bnl.ˏ().ॱ();
        Intent intent = new Intent("ACTION_RESUME_TASK");
        intent.putExtra(HiAnalyticsConstant.BI_KEY_PACKAGE, sessionDownloadTask.ˊˊ());
        intent.putExtra("sessionId", sessionDownloadTask.ʾ());
        intent.setClass(ॱ, bne.class);
        ll.ˏ(ॱ).ˋ(intent);
    }

    static void ˋ(SessionDownloadTask sessionDownloadTask) {
        Context ॱ = bnl.ˏ().ॱ();
        Intent intent = new Intent("ACTION_RESERVE_TASK");
        intent.putExtra(HiAnalyticsConstant.BI_KEY_PACKAGE, sessionDownloadTask.ˊˊ());
        intent.putExtra("sessionId", sessionDownloadTask.ʾ());
        intent.setClass(ॱ, bne.class);
        ll.ˏ(ॱ).ˋ(intent);
    }

    public void onReceiveMsg(Context context, Intent intent) {
        if (intent != null) {
            String action = intent.getAction();
            if (!TextUtils.isEmpty(action)) {
                Object obj = -1;
                switch (action.hashCode()) {
                    case -2055766811:
                        if (action.equals("ACTION_ENQUEUE_TASK")) {
                            obj = null;
                            break;
                        }
                        break;
                    case -854323535:
                        if (action.equals("ACTION_RESERVE_TASK")) {
                            obj = 3;
                            break;
                        }
                        break;
                    case -732176614:
                        if (action.equals("ACTION_ENQUEUE_TASK_SAVE_FINISHED")) {
                            obj = 1;
                            break;
                        }
                        break;
                    case 1620569550:
                        if (action.equals("ACTION_RESUME_TASK")) {
                            obj = 2;
                            break;
                        }
                        break;
                }
                long longExtra;
                switch (obj) {
                    case null:
                        longExtra = intent.getLongExtra("sessionId", -1);
                        if (bnl.ˏ().ˊ(longExtra) != null) {
                            bnf.ॱ(longExtra);
                            return;
                        }
                        return;
                    case 1:
                    case 2:
                        ˎ(intent.getLongExtra("sessionId", -1));
                        return;
                    case 3:
                        longExtra = intent.getLongExtra("sessionId", -1);
                        if (longExtra >= 0) {
                            bnf.ˎ(longExtra);
                            return;
                        }
                        return;
                    default:
                        return;
                }
            }
        }
    }

    private void ˎ(long j) {
        SessionDownloadTask ˊ = bnl.ˏ().ˊ(j);
        if (ˊ != null) {
            bnr.ˋ(ˊ);
        }
    }
}
